//
//  RPAlertTransitioningHandler.m
//  RPCommonKit
//
//  Created by Deabel on 2023/11/6.
//

#import "RPAlertTransitioningHandler.h"
#import "RPBaseAnimation.h"

@implementation RPAlertTransitioningHandler

// 弹出动画
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
    switch (self.transitionAnimation) {
        case RPAlertTransitionAnimationSpring:
            return [RPAlertSpringAnimation alertAnimationIsPresenting:YES];
        case RPAlertTransitionAnimationNormal:
            return [RPAlertNormalAnimation alertAnimationIsPresenting:YES];
        case RPAlertTransitionAnimationDropDown:
            return [RPAlertDropDownAnimation alertAnimationIsPresenting:YES];
        default:
            return [RPAlertNoneAnimation alertAnimationIsPresenting:YES];
    }
}

// 消失动画
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
    switch (self.transitionAnimation) {
        case RPAlertTransitionAnimationSpring:
            return [RPAlertSpringAnimation alertAnimationIsPresenting:NO];
        case RPAlertTransitionAnimationNormal:
            return [RPAlertNormalAnimation alertAnimationIsPresenting:NO];
        case RPAlertTransitionAnimationDropDown:
            return [RPAlertDropDownAnimation alertAnimationIsPresenting:NO];
        default:
            return [RPAlertNoneAnimation alertAnimationIsPresenting:NO];
    }
}

@end
